package com.csweimei.rentmanagementtreasure.tenant.viewModel;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.http.entity.TabOneBean;
import com.csweimei.rentmanagementtreasure.pop.PopNotice;
import com.csweimei.rentmanagementtreasure.pop.PopUtils;
import com.csweimei.rentmanagementtreasure.tenant.ui.act.LeaseDetailActivity;
import com.lxj.xpopup.XPopup;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class TabOneItem1VM extends MultiItemViewModel {
    public TabOneItem1VM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
    }

    public ObservableField<TabOneBean.DataDTO.DueDTO> bean = new ObservableField<>();

    public void setData(TabOneBean.DataDTO.DueDTO s) {
        bean.set(s);
    }

    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putInt("id",bean.get().getId());
            viewModel.startActivity(LeaseDetailActivity.class,bundle);
        }
    });


    public BindingCommand editClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            PopNotice popNotice =   new PopNotice(viewModel.mActivity);
            popNotice.setMsg(bean.get().getTitle());
            PopUtils.showPop(viewModel.mActivity, popNotice,false);
        }
    });
}
